package com.benyq.networkprogramme

import android.content.Context
import com.benyq.networkprogramme.base.adapter.BenyqBaseAdapter
import com.benyq.networkprogramme.base.adapter.BenyqRVHolder
import com.benyq.networkprogramme.base.bean.Msg

/**
 * @author benyq
 * @date 18-9-26 18:03
 * @E-mail： 1520063035@qq.com
 * @description
 */
class MsgAdapter(val context: Context): BenyqBaseAdapter<Msg>(context, R.layout.item_msg) {
    override fun convert(holder: BenyqRVHolder, position: Int, bean: Msg) {
        when(bean.type){
            Msg.type_received -> {
                holder.setVisibility(R.id.tvMsgRight, false)
                holder.setText(R.id.tvMsgLeft, bean.msg)
            }
            Msg.type_sent -> {
                holder.setVisibility(R.id.tvMsgLeft, false)
                holder.setText(R.id.tvMsgRight, bean.msg)
            }
        }
    }
}